Skip to content

Allow spaces in IDE install path on Linux #3973

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 14, 2015

Conversation

matthijskooijman
Copy link
Collaborator

The startup bash script lacked quotes in some places, causing it to
interpret part of the path to the splash image as the main class and
fail to start:

arduino: line 29: [: /home/a/Arduino: binary operator expected
Error: Could not find or load main class IDE.lib.splash.png

For the -splash option, simply adding quotes was not sufficient. If no
splash screen was to be used (so when $SPLASH was empty), using
"$SPLASH" would result in an empty argument being passed to java, which
was then interpreted by java as the name of the base class.

To allow spaces to occur in the -splash option, but also allow it to be
omitted entirely, options to java are now passed through the
$JAVA_OPTIONS array. By using the special "${JAVA_OPTIONS[@]}" syntax,
each element in the array is expanded into a single argument, even when
spaces are present inside (this is identical to what happens with "$@").

This fixes #3950

The startup bash script lacked quotes in some places, causing it to
interpret part of the path to the splash image as the main class and
fail to start:

arduino: line 29: [: /home/a/Arduino: binary operator expected
Error: Could not find or load main class IDE.lib.splash.png

For the -splash option, simply adding quotes was not sufficient. If no
splash screen was to be used (so when $SPLASH was empty), using
"$SPLASH" would result in an empty argument being passed to java, which
was then interpreted by java as the name of the base class.

To allow spaces to occur in the -splash option, but also allow it to be
omitted entirely, options to java are now passed through the
$JAVA_OPTIONS array. By using the special "${JAVA_OPTIONS[@]}" syntax,
each element in the array is expanded into a single argument, even when
spaces are present inside (this is identical to what happens with "$@").

This fixes arduino#3950
@matthijskooijman
Copy link
Collaborator Author

@ArduinoBot build this please

@cmaglie cmaglie self-assigned this Oct 14, 2015
@cmaglie cmaglie added this to the Release 1.6.6 milestone Oct 14, 2015
@cmaglie cmaglie merged commit bef7bb5 into arduino:master Oct 14, 2015
JAVA_OPTIONS+=("-splash:$APPDIR/lib/splash.png")
fi

$JAVA "${JAVA_OPTIONS[@]}" processing.app.Base "$@"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable JAVA can be obtained from:

JAVA=$APPDIR/java/bin/java

when the if on line 24 is followed and, since APPDIR may contain spaces, the last line should be changed to:

"$JAVA" "${JAVA_OPTIONS[@]}" processing.app.Base "$@"

(adding quotes to the $JAVA call), do you agree?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, agreed! Will you change it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here we go a6602ca

@matthijskooijman matthijskooijman deleted the spaces-in-path branch January 28, 2016 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IDE does not launch
3 participants